class Text {
  constructor(txt, options = {}) {
    this.canDraw = false;

    const _options = {
      font: '16px Arial',
      angle: 0,
      maxWidth: 100,
    };

    this.txt = txt;
    this.options = { ..._options, ...options };
  }

  render(ctx, canvas) {
    const { txt, options } = this;
    const { x, y, maxWidth = 100, font, angle } = options;

    ctx.beginPath();

    ctx.save();
    ctx.translate(x, y);
    ctx.rotate(deg2Rad(angle));

    ctx.font = font;
    ctx.fillText(txt, 0, 0, maxWidth);

    ctx.restore();
    ctx.closePath();
  }
}